package Zoo.handler;


import Zoo.view.leaderview.AddZoomenView;
import Zoo.view.leaderview.DeleteZoomenView;
import Zoo.view.leaderview.LeaderView1;
import Zoo.view.leaderview.UpdateZoomenView;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 园长所看到的动物饲养员的增删改查功能
 */

public class LeaderView1Handler implements ActionListener {
    private LeaderView1 leaderView1;


    public LeaderView1Handler(LeaderView1 leaderView1) {
        this.leaderView1 = leaderView1;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        JButton jButton = (JButton) e.getSource();
        String text = jButton.getText();
        if ("增加".equals(text)) {
            new AddZoomenView(leaderView1);
        } else if ("修改".equals(text)) {
            new UpdateZoomenView(leaderView1);
        } else if ("删除".equals(text)) {
            new DeleteZoomenView(leaderView1);
        } else if ("查询".equals(text)) {
            leaderView1.reloadTable();

        }
    }

}
